@extends('admin/layout')

@section('content')
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
                <li><a href="#">商品管理</a></li>
                <li class="active">标签列表</li>
            </ol>
            <div class="input-group margin">
                <form action="{{ url('admin/lable') }}" method="post" >
                    {{ csrf_field() }}
                    <select style="width: 150px"  name="searchtype" class="form-control">
                        @foreach($searchtype as $value)
                            <option value="{{ $value['id'] }}">{{ $value['searchtype'] }}</option>
                        @endforeach
                    </select>
                    <input style="width: 200px"  name="param" type="text" class="form-control">
                    <input  type="submit" class="btn btn-info btn-flat" value="Go!">
                </form>
            </div>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-md-12" style="width: 100%;">
                    <div class="box">
                        <div class="box-header with-border">
                            <h3 class="box-title">内容</h3>
                        </div>
                        <span id="msg" style="display: none">
                            @if (count($errors) > 0)
                                @foreach ($errors->all() as $error)
                                    <div style="width: 100%;">
                                        <span style="color: red;display: block;margin: 0px auto;width: 200px;text-align: center;">{{ $error }}</span>
                                    </div>
                                @endforeach
                            @else
                                <div style="width: 100%;">
                                    <span style="color: green;display: block;margin: 0px auto;width: 200px;text-align: center;">{{ Session::get('msg') }}</span>
                                </div>
                            @endif
                        </span>
                        <script type="text/javascript">
                            var _msg = $('#msg div span').text();
                            console.log(_msg);
                            if(_msg != ''){
                                layer.msg(_msg);
                            }
                        </script>
                        <div class="box-body">
                            <table class="table table-striped table-hover text-center">
                                <tr>
                                    @foreach($searchtype as $value)
                                        <th style="width: 50px; text-align:center">{{ $value['searchtype'] }}</th>
                                    @endforeach
                                    <th style="width: 50px; text-align:center">操作</th>
                                </tr>
                                @foreach($list as $value)
                                    <tr>
                                        <td>{{ $value['id'] }}</td>
                                        <td>{{ $value['create_time'] }}</td>
                                        <td>{{ $value['update_time'] }}</td>
                                        <td>{{ $value['name'] }}</td>
                                        <td>
                                            <a class="btn btn-warning btn-xs"  href="{{ url('admin/lable/getLable/'.$value['id']) }}" >修改<a>
                                        </td>
                                    </tr>
                                @endforeach
                            </table>
                        </div>
                        <!-- /.box -->
                    </div>
                    <!-- /.row -->
                </div>
            </div>
        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
@stop